{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-btn-group">
            <a href="{:url('admin/exam/typeAdd')}" class="layui-btn ajax-iframe" data-width="800px" data-height="500px"><i class="fa fa-plus-circle"></i>添加题型</a>
            <a href="{:url('admin/exam/typeDel')}" class="layui-btn layui-btn-danger ajax-batch"><i class="fa fa-trash-o"></i> 批量删除</a>
        </div>
        <table class="layui-table layui-form">
            <thead>
            <tr>
                <th style="width:20px;"><input type="checkbox" lay-skin="primary" lay-filter="*"></th>
                <th style="width:20px;">ID</th>
                <th style="width:160px;">题型</th>
                <th >题型分类</th>
                <th >题型标识</th>
                <th  style="width:160px;">排序</th>
                {if condition="$userInfo.is_teacher eq 1"}
                <th  style="width:60px;">操作</th>
                {else /}
                <th  style="width:120px;">操作</th>
                {/if}
            </tr>
            </thead>
            <tbody>
            {foreach name="list" item="v" empty="$empty"}
            <tr>
                <td><input type="checkbox" name="id" value="{$v.id}" lay-skin="primary"></td>
                <td>{$v.id}</td>
                <td>{$v.type_name}</td>
                <td>{$v.p_type|get_pre_type}</td>
                <td>{$v.mark}</td>
                <td><input type="text" name="sort_order" value="{$v.sort_order}" autocomplete="off" class="layui-input ajax-update" data-url="{:url('admin/exam/typeEdit', ['id' => $v.id])}"></td>
                <td>
                    <a href="{:url('admin/exam/typeEdit', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-normal ajax-iframe" data-width="800px" data-height="500px"><i class="fa fa-edit"></i> 编辑</a>
                    {if condition="$userInfo.is_teacher eq 1"}
                    {else /}
                    <a href="{:url('admin/exam/typeDel', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-danger ajax-delete"><i class="fa fa-trash-o"></i> 删除</a>
                    {/if}
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
</div>
{/block}
